﻿@model CustomerAvatarModel
@using Nop.Web.Models.Customer;
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
}
@using Nop.Web.Framework;
@*set "data-ajax" attribute to "false" because jQuery Mobile does not support file uploading*@
@using (Html.BeginRouteForm("CustomerAvatar", FormMethod.Post,
    new Dictionary<string, Object> { { "enctype", "multipart/form-data" }, { "data-ajax", "false" } }))
{
    <div class="account-page">
        <div class="page-title">
            <h1>@T("Account.Avatar")</h1>
        </div>
        <div class="clear">
        </div>
        <div class="body">
            <div class="customer-avatar">
                <div class="message-error">
                    @Html.ValidationSummary(true)
                </div>
                <div class="clear">
                </div>
                <div class="section-body">
                    @if (!String.IsNullOrEmpty(Model.AvatarUrl))
                    {
                        <img src="@(Model.AvatarUrl)" alt="avatar" />
                        <br />
                    }
                    <input name="uploadedFile" type="file" />
                </div>
                <div class="clear">
                </div>
                <div class="buttons">
                    <button type="submit" name="upload-avatar" value="upload-avatar">@T("Common.Upload")</button>
                    @if (!String.IsNullOrEmpty(Model.AvatarUrl))
                    {
                        <button type="submit" name="remove-avatar" value="remove-avatar">@T("Account.Avatar.RemoveAvatar")</button>
                    }
                </div>
                <div class="clear">
                </div>
                <div>
                    @T("Account.Avatar.UploadRules")</div>
            </div>
        </div>
    </div>
}